package com.automobile.backstage.service.impl;

import com.automobile.backstage.dao.SugestDao;
import com.automobile.backstage.domain.Sugest;
import com.automobile.backstage.service.SugestService;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;


@Service("sugestService")
public class SugestServiceImpl implements SugestService {

	@Autowired
	private SugestDao sugestDao;
	
	public void newSugest(String message) {
		sugestDao.newSugest(message);
	}

    @Override
    public List<Sugest> findAll(Integer page, Integer size) throws Exception {
        PageHelper.startPage(page,size);
        return sugestDao.findAll();
    }

    @Override
    public Sugest findById(Integer id) throws Exception {
        return sugestDao.findById(id);
    }

    @Override
    public void del(List<Integer> ids) throws Exception {
        for(Integer id:ids){
            sugestDao.del(id);
        }
    }


}
